import sys
from pathlib import Path

from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QApplication

from ui.main_window import VideoPlayerWindow

if __name__ == "__main__":
    app = QApplication(sys.argv)
    # 设置窗口图标
    icon_path = str(Path(__file__).parent / "resources" / "favicon.ico")
    if Path(icon_path).exists():
        app.setWindowIcon(QIcon(icon_path))
        # 2. Windows专属设置
    if sys.platform == "win32":
        import ctypes
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("MyMovieApp.Unique.ID")
    window = VideoPlayerWindow()
    window.show()
    # 双重保险：强制刷新图标
    window.setWindowIcon(QIcon(icon_path)) if Path(icon_path).exists() else None
    sys.exit(app.exec())